<?php


namespace app\admin\model;


use think\facade\Db;
use think\Model;
use think\model\concern\SoftDelete;

class WorkRun extends Model
{
    protected $name = 'run';


    public function admin()
    {
        return $this->belongsTo(Admin::class, 'uid');
    }


    public static function searchTable($table, $table_id)
    {
        $db = Db::name($table)->find($table_id);
        switch ($table){
            case "vacations":
                $db['qb'] = 1;
                $db['shiyou'] = $db['remark'] ?? '';
                break;
            case "applies":
                $db['qb'] = 2;
                $db['shiyou'] = $db['content'] ?? '';
                break;
        }
        return $db;
    }

    public function process(){
        return $this->belongsTo(FlowProcess::class,'run_flow_process','id');
    }

}